﻿using System;
using System.Linq;
using Orange.Logistics.Models;
using Orange.Logistics.Infrastructure;
using Orange.Logistics.Services;
using System.Web.Mvc;
using Newtonsoft.Json;
using System.Collections.Generic;

namespace Orange.Logistics.Controllers {

    public class CustomerController : BaseController<Customer> {
        private readonly ICustomerService service;

        public CustomerController(ICustomerService service)
            : base(service) {
            this.service = service;
        }

        protected override Func<Customer, object> GetOrderBy(string sort) {
            return c => {
                switch (sort) {
                    case "CustomerName":
                        return c.CustomerName;
                    case "ShortName":
                        return c.ShortName;
                    case "MnCode":
                        return c.MnCode;
                    case "Address":
                        return c.Address;
                    case "Phones":
                        return c.Phones;
                    case "Contract":
                        return c.Contract;
                    default:
                        return c.CustomerId;
                }
            };
        }
    }
}